AppleScript

This section gives an overview of SoundApp’s support for the AppleEvent Object Model and AppleScript. Not everything is documented here. For more information, see your documentation on AppleScript and the Scripting Dictionary of SoundApp using your favorite script editor.

Script Menu
SoundApp supports a script menu which allows scripts to be executed directly from a menu in SoundApp. In order to utilize this feature, create a folder called “Script Menu Items” in the same directory as the SoundApp application. Then place compiled scripts into the folder and launch SoundApp. A new “Script” menu will be added to the menu bar, listing the scripts in the folder. Simply select one to run it. Scripts can direct SoundApp or other applications to do just about anything.

Application
In addition to the Core Suite of open, run, and quit (print is not supported), SoundApp supports the following verbs:

◊ convert alias, alias list, string, string list [to alias, alias list, string, string list] [encoding PCM, µLaw, IMA] [channels default, mono, stereo] [bits default, eight, sixteen] [rate rate] [law full, reduced, smart] [with(out) DOSify] [with(out) suffix] [as System7, suitcase, AIFF, Wave, AU, NeXT, SD, QuickTime] [start at time] [stop at time]: Converts the specified file(s) to the destination file(s). If multiple source files are specified and a single destination, the destination is assumed to be a folder. If no to parameter is specified, the default conversion output method is used (as specified in the Convert pane of the Preferences dialog). The encoding, channels and bits parameters allow the encoding, channel and bit resolution setting to be overridden. The rate parameter allows the output sampling rate setting to be changed. If these are omitted, the value specified in the Convert pane of the Preferences dialog will be used. The law parameter controls whether µ-law and a-law files are converted as 16-bit (full), 8-bit (reduced) or 8-bit with smart processing (smart). The DOSify parameter causes new output file names to be created with the archaic MS-DOS 8.3 file name format. The suffix parameter causes the new output file to be created with a three letter dot-suffix, e.g., “.wav”. These last two are ignored if a single file is converted and the to parameter is specified. The as parameter allows the output sound format to be specified. Again, if it’s not specified, the default in the Convert pane of the Preferences dialog will be used instead. The start at and stop at parameters allow conversion of a specified range of the original sound file as specified in seconds. A single one may be specified, if desired.

◊ play alias, alias list, string, string list [bits default, eight, sixteen] [law full, reduced, smart] [buffer size] [MODDriver trecker, preferTrecker, preferZSS, ZSS] [MODStereo mono, stereo, enhanced] [with(out) MODFilter] [with(out) MODSixteen] [with(out) MODTempMem] [MODVolume volume] [MODRate rate] [MIDIDriver QuickTime, OMS] [with(out) sendGMReset] [with(out) ignoreSysEx] [with(out) useMIDIVolume] [start at time] [stop at time]: Plays the file or files passed as the direct parameter. The bits and law parameters function as above. The buffer parameter specifies the size in kilobytes of the buffer used for double-buffering. A value of zero means don’t double-buffer; otherwise, the value must be at least 64. The MODDriver, MODStereo, MODSixteen, MODFilter, MODTempMem, MODRate and modVolume parameters control the “MOD Driver,” “Stereo Mode,” “Real-Time Filter,” “16-Bit,” “Use System Memory,” “Playback Rate” and “Volume” settings in the MOD pane of the Preferences dialog respectively. The MIDIDriver, sendGMReset, ignoreSysEx and useMIDIVolume parameters control the “MIDI Driver,” “Send General MIDI Reset,” “Ignore SysEx Messages,” and “Use Playback Volume” settings in the MIDI pane of the Preferences dialog respectively. The volume value must be at least zero and no more than 255. The rate value must be at least 8000 and no more than 48000. The start at and stop at parameters allow playback of a specified range of the original sound file as specified in seconds.

◊ send oms data string: Sends raw MIDI data to an OMS synthesizer. The data is consists of a string of hexadecimal octets. MIDI timing is not supported. Also, remember to include the length fields for system exclusive messages. For example, to send a “GM Reset” command, use the command: send oms data "f0 05 7e 7f 09 01 f7". Note the “05” which is the length of the system exclusive message.

◊ display information for alias, alias list, string, string list: Opens an information window for each of the specified files.

◊ fetch information from alias, alias list, string, string list: Returns a record or list of records containing information about the specified sound file or files. The items of the record can be accessed by using the “get” verb. For example get name of (fetch information from …) returns the name of the file.

◊ get status: Returns one of idle, busy, paused indicating what SoundApp is currently doing.

◊ set status to paused, next, previous, stop after, stopped: Changes the current activity status of SoundApp. “Paused” pauses or resumes playback, “next” and “previous” jump to the next or previous file, “stop after” stops processing after the current file and “stopped” stops processing immediately.

◊ get preferences: Returns a record containing a list of all the global preferences.

◊ set preferences to preference: value …: Changes one or all of the global preferences based on a specified record. Single preferences can be operated on directly if desired, e.g., set autoQuit to true.

◊ get conversion setting specifier: Retrieves the indexed or named conversion setting. The object conversion settings can be used to retrieve a list of all of them.

◊ get setting of conversion setting: Retrieves an attribute from the specified conversion setting.

◊ set setting of conversion setting to specifier: Sets an attribute of the specified conversion setting to the specified value.

◊ set convert settings save flag to true, false: Sets an internal flag which controls whether to save the conversion settings whenever they are changed via an AppleEvent. This can speed processing, but the settings will be lost when SoundApp exits. This flag has no effect on changing the conversion settings via the user interface. It only affects scripting.

◊ get convert settings save flag: Returns the value of the internal flag which can be set with the above command.

◊ get playback volume: Returns the current playback volume SoundApp uses relative to the system volume. The number is in the range 1 to 384. A value of 256 is 100%.

◊ set playback volume to value: Sets the current playback volume SoundApp uses relative to the system volume. The value is the same as above.

◊ get current file: Returns a record containing the name, type, file specification and entry object in the Play List (if applicable) for the file currently being processed. The string "none" is returned if no file is currently being processed.

◊ get play position: Returns the current position in seconds in the file currently being played. If no file is being played zero is returned.

◊ set play position: Jumps to the specified position in seconds in the file currently being played, if possible. 

◊ show about, help, QnA window: Opens the About window and displays either the About, Help or Q & A pane, respectively. You can use “set/get pane” to manipulate the current pane in the window.

◊ yield: Yields time to SoundApp to process files. This can be used in an AppleScript loop which waits for status to go to idle to determine when SoundApp is done.

Play Lists
Play lists are referred to as a documents in SoundApp. The following verbs can be used on them:

◊ insert into document files file at position: Inserts the specified file at the specified position (an integer) in the Play List window document.

◊ play from document entries selected, list of entries: Plays either the currently selected entries or the list of entries specified.

◊ convert from document entries selected, list of entries: Converts either the currently selected entries or the list of entries specified.
 
◊ get information from document entries selected, list of entries: Gets information for either the currently selected entries or the list of entries specified.

◊ delete entry of document: Removes the specified entry from the list.

◊ move entry of document to location: Moves the specified entry to another location  in the list.

◊ copy entry of document to location: Creates a copy of the specified entry at another location in the list.

◊ set shuffle, repeatProcessing, auto play of document to true, false: Changes the value of the Shuffle and Repeat checkboxes and the Auto Play menu item.

◊ get shuffle, repeatProcessing, auto play of document: Retrieves the value of the Shuffle and Repeat checkboxes and the Auto Play menu item.

◊ get sort mode of document: Retrieves the sorting mode. Valid values are none, by name and by type.

◊ set sort mode of document to none, by name, by type: Retrieves or changes the sorting mode.

◊ get selection of document: Retrieves the current selection.

◊ set selection of document to entry, list of entries: Changes the selection to the specified entry or entries.

Objects
The following objects are supported:

◊ application: The SoundApp application.

◊ document: A Play List document. Documents can only be referenced by name.

◊ entry: An entry in a Play List.

◊ conversion setting: A list containing all the output setting parameters.

◊ preferences record: A record consisting of all the SoundApp global preferences. Settings in the Convert menu are not included here.